<style type="text/css">
.popUpWinBack{
  position: absolute;
  background: #808080;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0.2;
  z-index: 1040;
  position: fixed;
}
.popUpbox{
  position: absolute;
  width: 700px;
  height: 135;
  left: 34%;
  top: 10%;
  z-index: 1050;
  position: fixed;
}
.seach{
  height: 32px;
  width: 15%;
}
.btn-primary{
  margin-bottom: 4px;
}
</style>
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">列表</h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <form action="#" method="get" class="" _lpchecked="1">
                名称：
                <input type="text" name="q" id="searchcoupon" class="seach" placeholder="按名称搜索">
                <a class="btn btn-primary" onclick="searchCouponNmae()" >搜索</a>
              </form>
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th >图片</th>
                  <th>NAME1</th>
                  <th>NAME1</th>
                  <th>NAME1</th>
                  <th>NAME1</th>
                  <th>NAME1</th>                   
                  <th>NAME1</th>
                  <th>操作</th> 
                </tr>
                </thead>
                <tbody id="list">

                </tbody>
              </table>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <div id="popUpWin" style="display:none;">
      <div class="popUpWinBack"></div>
      <div class="box popUpbox">
        <div class="box-header" style="background: rgb(73,138,175);color:#fff;text-align: center;" ><h3 class="box-title">详情</h3>  </div>  
        <div class="box-body">     
          <div id="coupons_detail">
           
           
            <div id="coupons_detail" class="box box-widget widget-user">
                        <!-- Add the bg color to the header using any of the bg-* classes -->
                        <div class="widget-user-header bg-black" id="imgurl">
                          <h3 class="widget-user-username" id="name"> </h3>
                          <h5 class="widget-user-desc" id="credit" ></h5>
                        </div>
                        <div id="imgurl" class="widget-user-image">
                          <!-- <img class="img-circle" src="../dist/img/user3-128x128.jpg" alt="User Avatar"> -->
                        </div>
                        <div class="box-footer">
                          <div class="row">
                            <div class="col-sm-4 border-right">
                              <div class="description-block">
                                <h5 class="description-header" id="has_count" ></h5>
                                <span class="description-text">NAME1</span>
                              </div>
                              <!-- /.description-block -->
                            </div>
                            <!-- /.col -->
                            <div class="col-sm-4 border-right">
                              <div class="description-block">
                                <h5 class="description-header" id="price"></h5>
                                <span class="description-text">NAME1</span>
                              </div>
                              <!-- /.description-block -->
                            </div>
                            <!-- /.col -->
                            <div class="col-sm-4">
                              <div class="description-block">
                                <h5 class="description-header" id="stop_time"></h5>
                                <span class="description-text">NAME1</span>
                              </div>
                              <!-- /.description-block -->
                            </div>
                            <!-- /.col -->
                          </div>
                          <!-- /.row -->
                        </div> <div id="description"></div>
          </div>
          </div>     
          <div class="margin">          
            <!-- <button type="button" class="btn btn-block btn-success btn-lg">Success</button> -->
            <div class="btn-group"> <button id="confirmbox" class="btn btn-success" class="btn btn-block btn-success btn-lg">确认</button></div>          
            <div class="btn-group" style="float: right;"><button  id="cancelbox" class="btn btn-danger ">取消</button></div>
          </div> 
        </div>
      </div>
    </div>
    <script type="text/javascript">
      function popUpwindisplay(listid=0)//data,field,button=[]
      {
          var param ={};
          param.action = 'info';
          param.id = listid;
          param.bid = window.localStorage.getItem("bid"); 
          param.token = window.localStorage.getItem("token");
          var postdata = {};
          postdata.q = JSON.stringify( param);
          postdata.sign = $.md5(postdata.q+safe_key);
          // console.log(postdata);
          $.ajax({
              url: getapi(action),
              type : 'POST',
              data:postdata,
              contentType: "application/x-www-form-urlencoded",
               
              success : function(result) {//console.log(typeof result)
                  // var result = JSON.parse(result_str);
                  // console.log(result);
                  if (result.status =='no') {
                      if (window.localStorage.getItem("logoutNotice")!=1) {
                          alert('登录超时');
                          window.location.href=webhost;
                      }
                          window.localStorage.setItem("logoutNotice",1);
                  }else if (result.status !='ok'){
                      alert(result.message);
                  }else{ 
                      // console.log(result.data);
                      //$('#imgurl').append("<img  src='"+result.data.imgurl+"'/> ");
                      //$('#imgurl').style.background="background: url('../dist/img/photo1.png') center center;"
                      // stop_time_obj = new Date(result.data[0].stop_time*1000);
                      // stop_time_str = stop_time_obj.toLocaleDateString().replace(/\//g, "-") + " " + stop_time_obj.toTimeString().substr(0, 8)
                      $('#imgurl').css("background","url('"+imghost+result.data[0].imgurl+"') center center");
                      $('#name').text(result.data[0].name);
                      $('#credit').text("积分:"+result.data[0].credit);
                      $('#stop_time').text(result.data[0].stop_time_str);
                      $('#description').text(result.data[0].description);
                      $('#price').text(result.data[0].price);
                      $('#has_count').text(result.data[0].order_count);
                      
                  }
              },
              error: function() {
                  alert('获取数据失败！请刷新页面');
              }
          })
          $('#popUpWin').css('display','inherit');
      }
      function confirm(param={}){
        $('#cancelbox').click(function(){
                $('#popUpWin').css('display','none');
            });
        $('#confirmbox').click(function(){
                $('#popUpWin').css('display','none');
            });
      }
      confirm(param); 
      var param = {};
      param.action = 'goods_list';
      param.bid    = window.localStorage.getItem("bid"); 
      param.token    = window.localStorage.getItem("token");
      var button = new Array();
      button[0]= new Array();
      button[0][0] = "<a  class='btn btn-info' onclick='popUpwindisplay(";
      button[0][1] = ")' >详情</a>";
      var field = ["imgurl","name","original_count","order_count","has_draw","up_time_str","stop_time_str"];
      commonAjax(action,2,field,param,button);
    </script>


    